package bold.redisson;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;

import java.util.concurrent.TimeUnit;

public class SpringRedisCluster {
    public static void main(String[] args) {
//        ApplicationContext factory=new ClassPathXmlApplicationContext("classpath:spring-config-redis-cluster.xml");
        ApplicationContext factory=new ClassPathXmlApplicationContext("classpath:spring-config-redis-cluster-docker.xml");

        RedisTemplate redisTemplate = factory.getBean(RedisTemplate.class);

        ValueOperations<String,String> valueOperations = redisTemplate.opsForValue();

        while (true) {
            try {
                System.out.println("开始");
                valueOperations.set("2","aaaaaa");
                System.out.println(valueOperations.get("2"));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
